<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ZH-CN">
<head>
<c:choose>
  <c:when test="${student_name }==null">
    <c:redirect url="/LWGL"></c:redirect>
  </c:when>
</c:choose>
<title>开题报告</title>
<meta http-equiv="X-UA-Compatible" content="IE=9" >
<meta name="keywords" content="吉珠,吉林大学,吉林大学珠海学院,吉林大学珠海学院论文管理">
<meta name="content-type" content="text/html" charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href=".//css/bootstrap.css" type="text/css">
<script src=".//js/jquery-2.1.1.js" type="text/javascript"></script>
<script src=".//js/bootstrap.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/gray/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="<%=request.getContextPath()%>/jquery-easyui-1.4.1/themes/icon.css" type="text/css"></link>
<script type="text/javascript" src="<%=request.getContextPath()%>/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
<style>
.col-xs-3 {
	padding: 1px;
	height: 831px;
}
.col-xs-9 {
	height: 831px;
}
.container {
	width: 1280px;
}
.xs11 {
	margin-top: 20px;
	margin-left: 30px;
}
#right {
	position: absolute;
	right: 0px;
	width: 300px;
}
#X
{
position:absolute;
right:35px;
width:35px;
top:2px;
}
#xs12 {
	height: 725px;
	width: 313px;
}

#xs2{
	width:700px;
	height:35px;
	}
#xs1 {
	height: 100px;
	width: 80px;
}
body {
	font-size: 12px;
}
ul {
	margin: 0;
	padding: 7px;
}
ul li {
	height: 22px;
	vertical-align: bottom;
}
.actived {
	height: 25px;
	border-top: 3px solid #ff9900;
	;
	border-right: 1px solid #AAC7E9;
	border-left: 1px solid #AAC7E9;
	border-bottom: 1px solid #AAC7E9;
	background: #FFDAB9;
}
.panel-group {
	padding: 1px;
	margin: 1px;
}
</style>
<script type="text/javascript" language="javascript">


//后台人员代码开始---------------------------------------------------------
var stuinfo;
var stuOwnDis;
	$(function() {
		stuinfo = $('#stuinfo').datagrid({
			url : '<%=request.getContextPath()%>/openreportTable1',
			striped:true,
		    nowrap:false,
			 cache: false,
			fit : true,
			fitColumns : true,
			columns : [ [  {
				field : 'department_name',
				title : '院系',
				width : 150,
			}, {
				field : 'major_name',
				title : '专业',
				width : 100
			}, {
				field : 'student_name',
				title : '姓名',
				width : 100
			},  {
				field : 'teacher_name',
				title : '指导老师',
				width : 100
			}	
			 ] ]

		});
		
	});
	
	$(function() {
		stuOwnDis = $('#stuOwnDis').datagrid({
			url : '<%=request.getContextPath()%>/openreportTable2',
			striped:true,
		    nowrap:false,
			 cache: false,
			fit : true,
			fitColumns : true,
			onLoadSuccess:function(data){
						if(data.rows==false){
	    var obj =document.getElementById("stutable2");
         obj.innerHTML="<div class='alert alert-info' role='alert'>您还未上传文件！请在课题申报通过后自行上传论文稿的相关文件，等待教师审核！</div>";
					}
			},
			columns : [ [  {
				field : 'thesistitle_name',
				title : '课题名称',
				width : 150,
			}, {
				field : 'thesistitle_type',
				title : '类型',
				width : 100
			}, {
				field : 'thesissource_name',
				title : '来源',
				width : 100
			},  {
				field : 'kickoff_submittime',
				title : '提交时间',
				width : 100,
				width : 100,
				formatter : function(value, row, index) {
				if(value==null||value=="null"||value=="")
				return "<font color='#FF7F00'>未上传</font>";
				else
				return "<font color='#FF7F00'>"+value+"</font>";
				}
			},  {
				field : 'kickoff_report',
				title : '修改下载',
				width : 100,
				formatter : function(value, row, index) {
				//alert(value);
				if(value==null||value=="null"||value=="")
				return "<font color='#FF7F00'>记录为空</font>";
				else
				//return "<font color='#FF7F00'><a href='<%=request.getContextPath()%>/drafdownload?stuid=row.student_id'>下载</a></font>";
			    {
			    var url="openReportdownload?stu_rel_thesis_id="+row.stu_rela_thesis_id;
			    return "<font color='#FF7F00'><a onclick=DownLoad('"+url+"')>下载</a></font>";
			    }
			}
			},  {
				field : 'kickoff_tchmemo',
				title : '意见',
				width : 100,
				formatter : function(value, row, index) {
				if(row.kickoff_newmemo=="A")
			     return "<a onclick=show("+index+")><font color='#00FF00'>有更新</font></a>";
			     if(row.kickoff_newmemo=="B")
			     return "<a onclick=show("+index+")><font color='#FF7F00'>查看</font></a>";
			     return "<a onclick=show("+index+")><font color='#FF7F00'>查看</font></a>";
				}
			},{
				field : 'kickoff_passtype',
				title : '审核状态',
				width : 100,
					formatter : function(value, row, index) {
				if(value=="A")
				return "<font color='#FF7F00'>未审核</font>";
				if(value=="B")
				return "<font color='#FF5511'>指导教师审核未通过</font>";
				if(value=="C")
				{
				document.getElementById('bt').disabled=true;
				return "<font color='#00FF00'>指导教师审核通过</font>";
				}
				if(value=="D")
				return "<font color='#FF5511'>专业负责人审核未通过</font>";
				if(value=="E")
				{
					document.getElementById('bt').disabled=true;
				return "<font color='#00FF00'>专业负责人审核通过</font>";
				}
				if(value==null||value=="null"||value=="")
				return "<font color='#FF7F00'>未上传</font>";
			}
			}	
			 ] ]

		});
		
	});
	
	//下载--------------------------------------
	  function DownLoad(strUrl) {
            var form = $("<form>");   //定义一个form表单
            form.attr('style', 'display:none');   //在form表单中添加查询参数
            form.attr('target', '');
            form.attr('method', 'post');
            form.attr('action', "<%=request.getContextPath()%>/"+strUrl);

            var input1 = $('<input>');
            input1.attr('type', 'hidden');
            input1.attr('name', 'strUrl');
            input1.attr('value', strUrl);
            $('body').append(form);  //将表单放置在web中
            form.append(input1);   //将查询参数控件提交到表单上
            form.submit();
         }
	//下载--------------------------------------
	
	function show(index){
     //alert(index);
     var rows = $("#stuOwnDis").datagrid("getRows"); 
         var traget=document.getElementById("teacherComent");
          if(rows[index].kickoff_tchmemo==null)
         traget.value="无记录";
            else  traget.value=rows[index].kickoff_tchmemo;
             var traget_div=document.getElementById("teacherComent_div");
             traget_div.style.display="block";
    }
	
	function hide(id){
           var traget=document.getElementById(id);
            traget.style.display="none"; 
    }
	
//upload
   function uploadFile(form) {
      var path=form.fileToUpload1.value;
         if(path==""){
      alert("请选择上传文件");
          return;
      }
     var index=path.lastIndexOf(".");
      var result =path.substr(index+1);
      //alert(result);
     
      if(result!="doc")
      {
        alert("请上传文件格式为doc的文件");
          return;
      }
      
      path=form.fileToUpload2.value;
      index=path.lastIndexOf(".");
      result =path.substr(index+1);
      if(result=="zip"&&!result==""){}
       else if(result=="rar"&&!result==""){}
       else if(result=="ZIP"&&!result==""){}
       else if(result=="RAR"&&!result==""){}
       else if(path==""){}
       else
     {
       alert("请上传文件格式为zip,rar的文件");
          return;
      }
      
      var traget=document.getElementById("butToprogress");
      traget.innerHTML= "<p align='center'><progress id='progressBar' value='0' max='100'></progress><span id='percentage'></span></p>";

        var fd = new FormData();
        fd.append("开题报告正文", document.getElementById('fileToUpload1').files[0]);
        fd.append("开题报告附件", document.getElementById('fileToUpload2').files[0]);
        var xhr = new XMLHttpRequest();
        xhr.upload.addEventListener("progress", progressFunction, false);
        xhr.addEventListener("load", uploadComplete, false);
        xhr.addEventListener("error", uploadFailed, false);
        xhr.addEventListener("abort", uploadCanceled, false);
        xhr.open("POST", "<%=request.getContextPath()%>/mystuupload");
        xhr.send(fd);
      }

   function progressFunction(evt) {

            var progressBar = document.getElementById("progressBar");

            var percentageDiv = document.getElementById("percentage");

            if (evt.lengthComputable) {

                progressBar.max = evt.total;

                progressBar.value = evt.loaded;

                percentageDiv.innerHTML = Math.round(evt.loaded / evt.total * 100) + "%";

            }

        }  
        
      function uploadComplete(evt) {
        /* This event is raised when the server send back a response */
       
      alert(evt.target.responseText);
      
     
            // file.outerHTML = file.outerHTML;  
      //$.messager.alert("操作提示", "成功");
     parent.location.reload();//刷新页面
      }

      function uploadFailed(evt) {
        alert("上传失败");
      }

      function uploadCanceled(evt) {
        alert("上传已经取消");
      }
      
//后台人员代码结束---------------------------------------------------------
</script>
</head>

<body>
<!--全局框架 开始 conteiner-->
<div class="container"> 
  <!--标题头图片-->
  <div class="row">
    <div class="body_top"> <img src="img/head.png" align="center" width="1280px"/> </div>
  </div>
  <!--全局12栅格 规划全局区域图线 开始 row+ col-->
  <div class="row">
    <jsp:include page="stu_siderbar.jsp"></jsp:include>
        <!--全局框架结束--> 
        
        <!--右侧用户操作模块 占全局9栅格-->
        
        <div class="col-xs-9" style="border:2px solid #25465d">
          <div class="row">
            <div class="col-xs-5 xs11" style="margin-bottom:0px; margin-top:5px;"> <strong><font size="3">流程管理》开题报告提交</font></strong> </div>
            <div class="col-xs-5 xs11" id="right" style="margin-bottom:0px; margin-top:5px;" >
              <p><b><font size="3">毕业设计流转状态：&nbsp;&nbsp;&nbsp;开题阶段</p>
              </b></font> </div>
          </div>
          <div class="row">
            <div class="col-xs-11  xs11" style="margin-bottom:0px; margin-top:5px;">
              <div class="panel panel-default" style="margin-bottom:0px; margin-top:5px;">
                <div class="panel-heading" align="left"> <a data-toggle="collapse" data-parent="#accordion"  href="#collapseHelp" class="glyphicon glyphicon-chevron-down"> 操作指南 </a> </div>
                <div id="collapseHelp" class="panel-collapse collapse">
                  <div class="panel-body"> 毕业论文开题报告：
                    <ul>
                      <li>论文开题报告提交后，需等待指导教师审核，只有审核通过后，才算完成开题。</li>
                      <li>如果论文中包含大量的数学公式，请以附件的方式上传开题报告。</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- 后台人员的表格一开始 -->
          <div class="row">
            <div class="col-xs-11 xs11" style="margin-bottom:0px; margin-top:5px;height:80px">
              <p style="margin-bottom:0px; margin-top:5px;"><b><font size="3">吉林大学珠海学院本科毕业论文(设计)开题报告</font></b></p>
             <table id="stuinfo"></table>
            </div>
          </div>
          <!-- 后台人员的表格一结束 -->
          <!-- 后台人员的表格二开始 -->
          <form id="form1" enctype="multipart/form-data">
          <div class="row">
            <div class="col-xs-11 xs11" style="margin-bottom:5px; margin-top:5px;">
            <div id="stutable2" style="height:70px">
               <table id="stuOwnDis"></table>
            </div>
               <br/>
               <br/>
              <table class="table table-hover table-bordered" style="margin-top:0px; margin-bottom:5px;">
                <tbody>
                开题报告上传格式采用doc格式，开题报告附件上传格式采用rar或zip格式,便于教师修改。
                  <tr>
                    <td class="success" width="25%" align="center">
                        <label for="exampleInputFile">开题报告上传：</label>
                      </td>
                    <td width="80%"><div style="border:2px solid #25465d ; background-color:#d8d8d8;" id="xs2">
                          <label class="sr-only" for="inputfile">文件输入</label>    
                          <input type="file" id="fileToUpload1">
                        </div>
                      </div></td>
                  </tr>
                    <tr>
                    <td class="success" width="25%" align="center">
                        <label for="exampleInputFile">开题报告附件上传：</label>
                      </td>
                    <td width="80%"><div style="border:2px solid #25465d ; background-color:#d8d8d8;" id="xs2">
                          <label class="sr-only" for="inputfile">文件输入</label>    
                          <input type="file" id="fileToUpload2">
                        </div>
                      </div></td>
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
  <div id="butToprogress"><p align="center"><button id="bt"  type="button" class="btn btn-success btn-bg" name="" onclick="uploadFile(form1)" value="刷新"/>
                    上传</button></p>
                    </div>
            </form>    
         <!-- 后台人员的表格二结束 -->    
 
              <!-- 后台人员代码开始 -->
         <div class="row" align="center">
                <div class="col-xs-11  xs11" style="margin-top:5px; margin-bottom:0px;">
                   <div  id="teacherComent_div" class="panel-body" style="display:none">
                   <a data-toggle="collapse" data-parent="#accordion" href="#collapseSHYJ"><img src="img/close.png" id="X" onClick="hide('teacherComent_div');"></img></a> 
                   <h4 align="left">指导教师审核意见</h4>
                         <textarea id="teacherComent" class="form-control" rows="3" readonly="readonly" ></textarea>
                   </div> 
               </div> 
     </div> 
            <!--后台人员代码结束  -->
        </div>
     
        <!--修改结束--> 
        
        <!--全局12栅格 规划全局区域图线 结束 row+ col--> 
  </div>
<div class="row" style="background-color:#25465d"">
    <p  align="center" style="color:white;background-color:#25465d"><strong>用户单位：</strong>吉林大学珠海学院&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>版权所有：</strong>吉林大学珠海学院计算机科学与技术系</p>
  </div>
  <!--全局框架开始 conteiner--> 
</div>
</body>
</html>
